package org.zxp.datastructure.array;

import java.util.PriorityQueue;

/**
 * @program: effectiveJava
 * @description: PriorityQueue测试（优先队列）
 * @author: X-Pacific zhang
 * @create: 2019-08-08 15:43
 **/
public class PriorityQueueTest {
    public static void main(String[] args){
        PriorityQueue<Integer> queue = new PriorityQueue<>((o1, o2) -> {return o2 -o1; });
        queue.offer(1);
        queue.offer(4);
        queue.offer(234);
        queue.offer(8);
        queue.offer(3);
        queue.offer(99);
        queue.offer(12);
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());
        System.out.println(queue.poll());

    }
}
